import request from '@/util/request'
import store from '@/vuex/store'


// 添加新闻数据
export function addWechatNews(list) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(list)
    }
    return request({
        url: 'news/info/addWechatNews.do',
        method: 'post',
        data: value
    })
}

// 查询新闻数据
export function getWechatNews(list) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(list)
    }
    return request({
        url: 'news/info/getWechatNews.do',
        method: 'post',
        data: value
    })
}

// 查询新闻数据
export function getNewsData(list) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(list)
    }
    return request({
        url: 'news/info/getNewsData.do',
        method: 'post',
        data: value
    })
}
// 查询新闻数据
export function getNewsById(newsId) {
    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: newsId
    }
    return request({
        url: 'news/info/getNewsById.do',
        method: 'post',
        data: value
    })
}
// 修改新闻数据
export function editNewsInfo(list) {

    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(list)
    }
    return request({
        url: 'news/info/editNewsInfo.do',
        method: 'post',
        data: value
    })
}
// 删除新闻数据
export function removeNewsById(newsId) {

    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: newsId
    }
    return request({
        url: 'news/info/deleteNewsById.do',
        method: 'post',
        data: value
    })
}
// 更新新闻数据
export function updateNews(list) {

    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: JSON.stringify(list)
    }
    return request({
        url: 'news/info/updateNews.do',
        method: 'post',
        data: value
    })
}
// 更新所有新闻数据
export function updateAllNews(total) {

    const value = {
        appKey: '',
        appFlag: 2,
        token: store.getters.token,
        versionCode: 0,
        param: total
    }
    return request({
        url: 'news/info/updateAllNews.do',
        method: 'post',
        data: value
    })
}